package com.qyhl.webtv.basiclib.utils.glide;

import com.bumptech.glide.request.RequestOptions;

/**
 * @author helin
 */
public class GlideOptionsUtils {

    private GlideOptionsUtils() {
    }

    private static final GlideOptionsUtils glideOptionsUtils = new GlideOptionsUtils();

    public static GlideOptionsUtils getInstance() {
        return glideOptionsUtils;
    }


    /**
     * 首页item 图片加载option
     *
     * @param defaultCover
     * @param error
     * @param round
     * @return
     */
    public RequestOptions getOptions(int defaultCover, int error, int round) {
        RequestOptions options = new RequestOptions()
                .centerCrop()
                .placeholder(defaultCover)
                .error(error)
                .optionalTransform(new GlideRoundTransform(round));
        return options;
    }

    public RequestOptions getOptions(int defaultCover, int error) {
        RequestOptions options = new RequestOptions()
                .placeholder(defaultCover)
                .error(error);
        return options;
    }

    /**
     * 单图
     *
     * @param defaultCover
     * @param error
     * @param round
     * @return
     */
    public RequestOptions getSingleImageOptions(int defaultCover, int error, int round) {
        RequestOptions options = new RequestOptions()
                .optionalTransform(new GlideRoundTransform(round))
                .placeholder(defaultCover)
                .error(error);
        return options;
    }


}
